package base.stream;

import java.io.IOException;
import java.io.RandomAccessFile;

public class RandomAccessFileDemo {
    public static void main(String[] args) throws IOException {
        // test.txt >> hello
        RandomAccessFile randomAccessFile = new RandomAccessFile("C:\\Temp\\test\\test.txt", "r");
        randomAccessFile.seek(4);
        int data = randomAccessFile.read();

        long position = randomAccessFile.getFilePointer();

        System.out.println("data: " + (char) data);
        System.out.println("position: " + position);
    }
}
